3.7 \(\int \cos ^2(c+d x) (a+i a \tan (c+d x)) \, dx\)

Optimal. Leaf size=45 \[ -\frac {i a \cos ^2(c+d x)}{2 d}+\frac {a \sin (c+d x) \cos (c+d x)}{2 d}+\frac {a x}{2} \]

[Out]

1/2*a*x-1/2*I*a*cos(d*x+c)^2/d+1/2*a*cos(d*x+c)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 45, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 22, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.136, Rules used = {3486, 2635, 8} \[ -\frac {i a \cos ^2(c+d x)}{2 d}+\frac {a \sin (c+d x) \cos (c+d x)}{2 d}+\frac {a x}{2} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x]),x]

[Out]

(a*x)/2 - ((I/2)*a*Cos[c + d*x]^2)/d + (a*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 3486

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*(d*Sec[
e + f*x])^m)/(f*m), x] + Dist[a, Int[(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2
*m] || NeQ[a^2 + b^2, 0])

Rubi steps

\begin {align*} \int \cos ^2(c+d x) (a+i a \tan (c+d x)) \, dx &=-\frac {i a \cos ^2(c+d x)}{2 d}+a \int \cos ^2(c+d x) \, dx\\ &=-\frac {i a \cos ^2(c+d x)}{2 d}+\frac {a \cos (c+d x) \sin (c+d x)}{2 d}+\frac {1}{2} a \int 1 \, dx\\ &=\frac {a x}{2}-\frac {i a \cos ^2(c+d x)}{2 d}+\frac {a \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.04, size = 48, normalized size = 1.07 \[ \frac {a (c+d x)}{2 d}+\frac {a \sin (2 (c+d x))}{4 d}-\frac {i a \cos ^2(c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x]),x]

[Out]

(a*(c + d*x))/(2*d) - ((I/2)*a*Cos[c + d*x]^2)/d + (a*Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

fricas [A]  time = 0.67, size = 23, normalized size = 0.51 \[ \frac {2 \, a d x - i \, a e^{\left (2 i \, d x + 2 i \, c\right )}}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/4*(2*a*d*x - I*a*e^(2*I*d*x + 2*I*c))/d

________________________________________________________________________________________

giac [A]  time = 0.53, size = 23, normalized size = 0.51 \[ \frac {2 \, a d x - i \, a e^{\left (2 i \, d x + 2 i \, c\right )}}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

1/4*(2*a*d*x - I*a*e^(2*I*d*x + 2*I*c))/d

________________________________________________________________________________________

maple [A]  time = 0.32, size = 42, normalized size = 0.93 \[ \frac {-\frac {i a \left (\cos ^{2}\left (d x +c \right )\right )}{2}+a \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+I*a*tan(d*x+c)),x)

[Out]

1/d*(-1/2*I*a*cos(d*x+c)^2+a*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

maxima [A]  time = 0.48, size = 38, normalized size = 0.84 \[ \frac {{\left (d x + c\right )} a + \frac {a \tan \left (d x + c\right ) - i \, a}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*((d*x + c)*a + (a*tan(d*x + c) - I*a)/(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

mupad [B]  time = 3.23, size = 22, normalized size = 0.49 \[ \frac {a\,x}{2}+\frac {a}{2\,d\,\left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a + a*tan(c + d*x)*1i),x)

[Out]

(a*x)/2 + a/(2*d*(tan(c + d*x) + 1i))

________________________________________________________________________________________

sympy [A]  time = 0.16, size = 41, normalized size = 0.91 \[ \frac {a x}{2} + \begin {cases} - \frac {i a e^{2 i c} e^{2 i d x}}{4 d} & \text {for}\: 4 d \neq 0 \\\frac {a x e^{2 i c}}{2} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+I*a*tan(d*x+c)),x)

[Out]

a*x/2 + Piecewise((-I*a*exp(2*I*c)*exp(2*I*d*x)/(4*d), Ne(4*d, 0)), (a*x*exp(2*I*c)/2, True))

________________________________________________________________________________________